#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    /*方法二：在主窗口中设置图标
    需要用GSetting监听主题变化，如果不用则图标不会跟随主题*/
    const QByteArray id("org.ukui.style");
    if(QGSettings::isSchemaInstalled(id))
        gsettings = new QGSettings(id);
    connect(gsettings, &QGSettings::changed, this, [=] (const QString &key){
        if(key=="iconThemeName")
            setWindowIcon(QIcon::fromTheme("firefox"));
    });
    setWindowIcon(QIcon::fromTheme("firefox"));
}

MainWindow::~MainWindow()
{
    delete ui;
}

